package org.tinygroup.channel.test.protocol;

import org.tinygroup.channel.protocol.impl.AbstractProtocolListener;
import org.tinygroup.context.Context;

public class UserProtocolListener extends AbstractProtocolListener<User, User> {
	
	protected void preProcess(User request, Context context) {
		if (request.getAge() > 10) {
			request.setGrade(2);
		}else{
			request.setGrade(1);
		}
	}

	protected void postProcess(User request, User response, Context context) {
		if(2==response.getGrade()){
			response.setWeight(100);
		}else{
			response.setWeight(50);
		}
		
	}

}
